//
//  ViewController.m
//  06-Navigation作业
//
//  Created by dllo on 16/7/21.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "FirstViewController.h"
#import "AccountView.h"
#import "ThirdViewController.h"
#import "SccondiewController.h"
@interface ViewController ()

@end

@implementation ViewController


    // Do any additional setup after loading the view, typically from nib.
#if 0
    - (void)loadView
    {
        [super loadView];
        //    self.view.backgroundColor = [UIColor redColor];
        UIImageView *imageView1 = [[UIImageView alloc] initWithFrame:self.view.bounds];
        [self.view addSubview:imageView1];
        imageView1.image = [UIImage imageNamed:@"3"];
        
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 300, 50, 50)];
        
        [self.view addSubview:imageView];
        
        //        imageView.image = [UIImage imageNamed:@"4"];
        //    //
        //
        UIImageView *imageViewOfLogo = [[UIImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 100) / 2, 100, 100, 150)];
        [self.view addSubview:imageViewOfLogo];
        //
        imageViewOfLogo.image = [UIImage imageNamed:@"2"];
        //
        
        //        UIImageView *imageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 350, 50, 50)];
        //        [self.view addSubview:imageView2];
        //        imageView2.image = [UIImage imageNamed:@"5"];
        
        
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(185, 600, 23, 19)];
        label.backgroundColor = [UIColor clearColor];
        label.text = @"or";
        label.textColor = [UIColor whiteColor];
        [self.view addSubview:label];
        //
        
        //        UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(50, 300, self.view.frame.size.width - 50, 50)];
        //        textField.backgroundColor = [UIColor blackColor];
        //        textField.alpha = 0.2;
        //        textField.placeholder = @"请输入用户名";
        //        textField.clearsOnBeginEditing = YES;
        //        [self.view addSubview:textField];
        
        
        //        UITextField *textField1 = [[UITextField alloc] initWithFrame:CGRectMake(50, 350, self.view.frame.size.width - 50, 50)];
        //        textField1.backgroundColor = [UIColor whiteColor];
        //        textField1.placeholder = @"请输入密码";
        //        textField1.clearsOnBeginEditing = YES;
        //        [self.view addSubview:textField1];
        
        
        
        UIButton *button1 = [[UIButton alloc] initWithFrame:CGRectMake(20, 500, self.view.frame.size.width - 40, 40)];
        button1.backgroundColor = [UIColor greenColor];
        button1.alpha = 0.6;
        [button1 setTitle:@"返回登录" forState:UIControlStateNormal];
        
        [button1 addTarget:self action:@selector(button1Clicked) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button1];
        
        
        UIButton *button2 = [[UIButton alloc] initWithFrame:CGRectMake(20, 480, 80, 20)];
        button2.backgroundColor = [UIColor clearColor];
        [button2 setTitle:@"忘记密码" forState:UIControlStateNormal];
        [button2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [button2 addTarget:self action:@selector(button2Clicked) forControlEvents:UIControlEventTouchUpInside];
        
        [self.view addSubview:button2];
        
        
        UIButton *button3 = [[UIButton alloc] initWithFrame:CGRectMake(20,430 , self.view.frame.size.width - 40, 40)];
        button3.backgroundColor = [UIColor greenColor];
        [button3 setTitle:@"注册" forState:UIControlStateNormal];
        [button3 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [button3 addTarget:self action:@selector(button3Clicked) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button3];
        
        
        UIButton *button4 = [[UIButton alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 100 )/ 2, 550, 100, 30)];
        [button4 setTitle:@"随便逛逛" forState:UIControlStateNormal];
        [button4 addTarget:self action:@selector(button4Clicked) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button4];
        
        
        UIView *lineView1 = [[UIView alloc] initWithFrame:CGRectMake(12, 610, 150, 1)];
        lineView1.backgroundColor = [UIColor whiteColor];
        [self.view addSubview:lineView1];
        
        UIView *lineView2 = [[UIView alloc] initWithFrame:CGRectMake(220, 610, 150, 1)];
        lineView2.backgroundColor = [UIColor whiteColor];
        [self.view addSubview:lineView2];
        
        AccountView *accountView = [[AccountView alloc] initWithFrame:CGRectMake(10,300, 350, 80)];
        
        accountView.layer.cornerRadius = 5;
        accountView.layer.masksToBounds = YES;
        [self.view addSubview:accountView];
        
        UILabel *label1 = [[UILabel alloc] init];
        label.frame = CGRectMake(52, 390, 200, 20);
        label.text = @"注册代表你已同意";
        label.textColor = [UIColor clearColor];
        [self.view addSubview:label1];
        
        UILabel *label2 = [[UILabel alloc] init];
        label.frame = CGRectMake(100, 390, 200, 20);
        label.text = @"拉勾用户协议";
        label.textColor = [UIColor greenColor];
        //    [self.view addSubview:label2];
    }
#endif
    
    - (void)button1Clicked
    {
        NSLog(@"登录");
        SccondiewController *secondViewController = [[SccondiewController alloc] init];
        secondViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentViewController:secondViewController animated:YES completion:nil];
    }
    
    
    - (void)button2Clicked
    {
        NSLog(@"忘记密码");
        ThirdViewController *thirdViewController = [[ThirdViewController alloc] init];
        thirdViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentViewController:thirdViewController animated:YES completion:nil];
        
    }
    
    - (void)button3Clicked
    {
        NSLog(@"现在注册拉钩");
        FirstViewController *firstViewController = [[FirstViewController alloc] init];
        firstViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
        [self presentViewController:firstViewController animated:YES completion:nil];
        
        
    }
    
    - (void)button4Clicked
    {
        NSLog(@"随便逛逛");
        
    }




//1.更换拉钩登陆、注册、忘记密码等页面的切换方式, 使用NavgationController管理
//2.模仿QQ聊天页面的NavgationBar
//3.思考: 轮播图pageControl实现轮播效果
- (void)viewDidLoad {
    [super viewDidLoad];
    
    
//    self.title = @"标题";
    UISegmentedControl *seg = [[UISegmentedControl alloc] initWithItems:@[@"消息",@"电话"]];
    seg.frame = CGRectMake(0, 0, 150, 44);
    
    self.navigationItem.titleView = seg;
//    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(comBack:)];
    
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"2"] imageWithRenderingMode:1] style:UIBarButtonItemStylePlain target:self action:@selector(imageClicked:)];
    
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add:)];
    
    
    
    
    
    
    
    
    
    
    
}

- (void)add:(UIBarButtonItem *)barButtonItem
{
    
}




                                             - (void)imageClicked:(UIImage *)image
                                             {
                                                 NSLog(@"头像");
                                             }

- (void)comBack:(UIBarButtonItem *)barButtonItem
{
//    NSLog(@"返回");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
